package com.gao.array;
import java.sql.SQLOutput;
import java.util.Arrays;

/**
 * @Author: ShanYuqing
 * @Version: v1.0
 */
public class ArrayDemo {
    /*
        Arrays类常用方法:

            public static String toString (类型[] a) :将数组元素拼接为带有格式的字符串

            public static boolean equals (类型[] a,类型[] b) :比较两个数组内容是否相同

            public static int binarySearch (int[] a, int key) :查找元素在数组中的索引(二分在找法:保证数组的元素是排好序的)

            public ststic void sort(类型[] a):对数组进行默认升序排序

     */
    public static void main(String[] args) {
        int arr[] = {1,2,3,4};
        int arr2[] = {2,3,45,6};
        System.out.println(Arrays.toString(arr));
        System.out.println(Arrays.equals(arr, arr2));
        System.out.println(Arrays.binarySearch(arr, 1));
        Arrays.sort(arr2);
        System.out.println(Arrays.toString(arr2));
    }
}
